< previous page page_892 next page >

Page 892
Type.gifListing A.20. Coding the SQLdbClose routine.
Sub SQLdbClose()
    '
    ' close open database
    '
    On Error Resume Next ' ignore errors here
    '
    db.Close
    '
    For x = 0 To intForms
       Unload TblForms(x)
    Next x
    '
    intForms = 0
    intDBFlag = False
    '
End Sub
The final routine to handle special commands is the routine that processes the DBMAKE keyword to create new Microsoft Access Jet databases. This one works much like the DBOPEN routine except that there are a few additional chores when creating a new file. Create a Public Sub called SQLdbMake and enter the code in Listing A.21.
Type.gifListing A.21. Coding the SQLdbMake routine.
Sub SQLdbMake()
    '
    ' make a new database
    '
    On Error GoTo SQLdbMakeErr
    '
    Dim strMake As String
    Dim intTemp As Integer
    '
    strLine = Trim(strLine)  ' drop any spaces
    intTemp = InStr(strLine, " ") ' locate first embedded space
    strMake = Mid(strLine, intTemp + 1, 255) ' get rest of line
    '
    ' if line ends w/ ";", dump it!
    If Right(strMake, 1) = ";" Then
       strMake = Left(strMake, Len(strMake) - 1)
    End If
    '
    ' try to open it (to see if it already exists)
    nSQLMakeHandle = FreeFile(0)
    Open strMake For Input As nSQLMakeHandle
    Close nSQLMakeHandle
    '
    nResult = MsgBox("ERASE [" + strMake + "]", vbYesNo + vbQuestion, "Database
arrow.gifAlready Exists!")
    If nResult = vbYes Then

 
< previous page page_892 next page >

If you like this book, buy it!